package czh.cocoa.graphics;

import android.graphics.RectF;

import static java.lang.Math.*;

public class CGMutablePath extends CGPath {

	public void moveToPoint(CGAffineTransform m, float x, float y) {
		mPath.moveTo(x, y);
	}
	
	public void addLineToPoint(CGAffineTransform m, float x, float y) {
		mPath.lineTo(x, y);
	}
	
	public void addPath(CGAffineTransform m, CGPath path) {
		mPath.addPath(path.getPath());
	}
	
	public void addArc(CGAffineTransform m, float x, float y, float radius, float startAngle, float endAngle, int clockwise) {
		RectF oval = new RectF(x - radius, y - radius, x + radius, y + radius); 
		float startDegree = (float) (180 * (startAngle / PI));
		float endDegree = (float) (180 * (endAngle / PI));
		
		if (clockwise == 0) { 
			mPath.arcTo(oval, startDegree, endDegree - startDegree - 360);
		} else {
			mPath.arcTo(oval, startDegree, endDegree - startDegree);
		}

	}
	
	public void addArcToPoint(CGAffineTransform m, float x1, float y1, float x2, float y2, float radius) {
		
	}
	
	public void closeSubpath() {
		mPath.close();
	}
	
}
